using HKB.Common;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
namespace HKB.Data.Dal.H_LogTableAdapters
{
	[GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), DataObject(true), HelpKeyword("vs.data.TableAdapter"), Designer("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), DesignerCategory("code"), ToolboxItem(true)]
	public class HL_LogTableAdapter : Component
	{
		private SqlDataAdapter _adapter;
		private SqlConnection _connection;
		private SqlCommand[] _commandCollection;
		private bool _clearBeforeFill;
		[System.Diagnostics.DebuggerNonUserCode]
		private SqlDataAdapter Adapter
		{
			get
			{
				if (this._adapter == null)
				{
					this.InitAdapter();
				}
				return this._adapter;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		internal SqlConnection Connection
		{
			get
			{
				if (this._connection == null)
				{
					this.InitConnection();
				}
				return this._connection;
			}
			set
			{
				this._connection = value;
				if (this.Adapter.InsertCommand != null)
				{
					this.Adapter.InsertCommand.Connection = value;
				}
				if (this.Adapter.DeleteCommand != null)
				{
					this.Adapter.DeleteCommand.Connection = value;
				}
				if (this.Adapter.UpdateCommand != null)
				{
					this.Adapter.UpdateCommand.Connection = value;
				}
				for (int i = 0; i < this.CommandCollection.Length; i++)
				{
					if (this.CommandCollection[i] != null)
					{
						this.CommandCollection[i].Connection = value;
					}
				}
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		protected SqlCommand[] CommandCollection
		{
			get
			{
				if (this._commandCollection == null)
				{
					this.InitCommandCollection();
				}
				return this._commandCollection;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public bool ClearBeforeFill
		{
			get
			{
				return this._clearBeforeFill;
			}
			set
			{
				this._clearBeforeFill = value;
			}
		}
		[System.Diagnostics.DebuggerNonUserCode]
		public HL_LogTableAdapter()
		{
			this.ClearBeforeFill = true;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitAdapter()
		{
			this._adapter = new SqlDataAdapter();
			DataTableMapping dataTableMapping = new DataTableMapping();
			dataTableMapping.SourceTable = "Table";
			dataTableMapping.DataSetTable = "HL_Log";
			dataTableMapping.ColumnMappings.Add("LogID", "LogID");
			dataTableMapping.ColumnMappings.Add("VisitUrl", "VisitUrl");
			dataTableMapping.ColumnMappings.Add("OperatInfo", "OperatInfo");
			dataTableMapping.ColumnMappings.Add("OperaTime", "OperaTime");
			dataTableMapping.ColumnMappings.Add("Operator", "Operator");
			dataTableMapping.ColumnMappings.Add("OperatorIP", "OperatorIP");
			dataTableMapping.ColumnMappings.Add("OperatorHostName", "OperatorHostName");
			dataTableMapping.ColumnMappings.Add("LogType", "LogType");
			dataTableMapping.ColumnMappings.Add("LoginErrTimes", "LoginErrTimes");
			this._adapter.TableMappings.Add(dataTableMapping);
			this._adapter.DeleteCommand = new SqlCommand();
			this._adapter.DeleteCommand.Connection = this.Connection;
			this._adapter.DeleteCommand.CommandText = "DELETE FROM [HL_Log] WHERE (([LogID] = @Original_LogID))";
			this._adapter.DeleteCommand.CommandType = CommandType.Text;
			this._adapter.DeleteCommand.Parameters.Add(new SqlParameter("@Original_LogID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "LogID", DataRowVersion.Original, false, null, "", "", ""));
			this._adapter.InsertCommand = new SqlCommand();
			this._adapter.InsertCommand.Connection = this.Connection;
			this._adapter.InsertCommand.CommandText = "INSERT INTO [HL_Log] ([VisitUrl], [OperatInfo], [OperaTime], [Operator], [OperatorIP], [OperatorHostName], [LoginErrTimes], [LogType]) VALUES (@VisitUrl, @OperatInfo, @OperaTime, @Operator, @OperatorIP, @OperatorHostName, @LoginErrTimes, @LogType)";
			this._adapter.InsertCommand.CommandType = CommandType.Text;
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@VisitUrl", SqlDbType.NText, 0, ParameterDirection.Input, 0, 0, "VisitUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OperatInfo", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "OperatInfo", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OperaTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "OperaTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@Operator", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Operator", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OperatorIP", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "OperatorIP", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@OperatorHostName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "OperatorHostName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@LoginErrTimes", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "LoginErrTimes", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.InsertCommand.Parameters.Add(new SqlParameter("@LogType", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "LogType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand = new SqlCommand();
			this._adapter.UpdateCommand.Connection = this.Connection;
			this._adapter.UpdateCommand.CommandText = "UPDATE [HL_Log] SET [VisitUrl] = @VisitUrl, [OperatInfo] = @OperatInfo, [OperaTime] = @OperaTime, [Operator] = @Operator, [OperatorIP] = @OperatorIP, [OperatorHostName] = @OperatorHostName, [LoginErrTimes] = @LoginErrTimes, [LogType] = @LogType WHERE (([LogID] = @Original_LogID))";
			this._adapter.UpdateCommand.CommandType = CommandType.Text;
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@VisitUrl", SqlDbType.NText, 0, ParameterDirection.Input, 0, 0, "VisitUrl", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OperatInfo", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "OperatInfo", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OperaTime", SqlDbType.DateTime, 0, ParameterDirection.Input, 0, 0, "OperaTime", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Operator", SqlDbType.NVarChar, 0, ParameterDirection.Input, 0, 0, "Operator", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OperatorIP", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "OperatorIP", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@OperatorHostName", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "OperatorHostName", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@LoginErrTimes", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "LoginErrTimes", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@LogType", SqlDbType.VarChar, 0, ParameterDirection.Input, 0, 0, "LogType", DataRowVersion.Current, false, null, "", "", ""));
			this._adapter.UpdateCommand.Parameters.Add(new SqlParameter("@Original_LogID", SqlDbType.Int, 0, ParameterDirection.Input, 0, 0, "LogID", DataRowVersion.Original, false, null, "", "", ""));
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitConnection()
		{
			this._connection = new SqlConnection();
			this._connection.ConnectionString = Conn.CurrenConnectionStrings;
		}
		[System.Diagnostics.DebuggerNonUserCode]
		private void InitCommandCollection()
		{
			this._commandCollection = new SqlCommand[4];
			this._commandCollection[0] = new SqlCommand();
			this._commandCollection[0].Connection = this.Connection;
			this._commandCollection[0].CommandText = "SELECT LogID, VisitUrl, OperatInfo, OperaTime, Operator, OperatorIP, OperatorHostName, \r\n      LoginErrTimes, LogType\r\nFROM HL_Log\r\nORDER BY OperaTime DESC";
			this._commandCollection[0].CommandType = CommandType.Text;
			this._commandCollection[1] = new SqlCommand();
			this._commandCollection[1].Connection = this.Connection;
			this._commandCollection[1].CommandText = "SELECT LogID, LogType, LoginErrTimes, OperaTime, OperatInfo, Operator, OperatorHostName, OperatorIP, VisitUrl FROM HL_Log WHERE (LogID = @LogID)";
			this._commandCollection[1].CommandType = CommandType.Text;
			this._commandCollection[1].Parameters.Add(new SqlParameter("@LogID", SqlDbType.Int, 4, ParameterDirection.Input, 0, 0, "LogID", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[2] = new SqlCommand();
			this._commandCollection[2].Connection = this.Connection;
			this._commandCollection[2].CommandText = "SELECT LogID, LogType, LoginErrTimes, OperaTime, OperatInfo, Operator, OperatorHostName, OperatorIP, VisitUrl FROM HL_Log WHERE (OperatorIP = @OperatorIP) AND (DATEDIFF(hour, OperaTime, GETDATE()) <= 24)";
			this._commandCollection[2].CommandType = CommandType.Text;
			this._commandCollection[2].Parameters.Add(new SqlParameter("@OperatorIP", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "OperatorIP", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3] = new SqlCommand();
			this._commandCollection[3].Connection = this.Connection;
			this._commandCollection[3].CommandText = "SELECT LogID, LogType, LoginErrTimes, OperaTime, OperatInfo, Operator, OperatorHostName, OperatorIP, VisitUrl FROM HL_Log WHERE (OperatorIP = @OperatorIP) AND (OperatorHostName = @OperatorHostName)";
			this._commandCollection[3].CommandType = CommandType.Text;
			this._commandCollection[3].Parameters.Add(new SqlParameter("@OperatorIP", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "OperatorIP", DataRowVersion.Current, false, null, "", "", ""));
			this._commandCollection[3].Parameters.Add(new SqlParameter("@OperatorHostName", SqlDbType.VarChar, 50, ParameterDirection.Input, 0, 0, "OperatorHostName", DataRowVersion.Current, false, null, "", "", ""));
		}
		[DataObjectMethod(DataObjectMethodType.Select, true), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Log.HL_LogDataTable GetAllLog()
		{
			this.Adapter.SelectCommand = this.CommandCollection[0];
			H_Log.HL_LogDataTable hL_LogDataTable = new H_Log.HL_LogDataTable();
			this.Adapter.Fill(hL_LogDataTable);
			return hL_LogDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Log.HL_LogDataTable GetLogByLogID(int LogID)
		{
			this.Adapter.SelectCommand = this.CommandCollection[1];
			this.Adapter.SelectCommand.Parameters[0].Value = LogID;
			H_Log.HL_LogDataTable hL_LogDataTable = new H_Log.HL_LogDataTable();
			this.Adapter.Fill(hL_LogDataTable);
			return hL_LogDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Log.HL_LogDataTable GetLogByIP(string OperatorIP)
		{
			this.Adapter.SelectCommand = this.CommandCollection[2];
			if (OperatorIP == null)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = OperatorIP;
			}
			H_Log.HL_LogDataTable hL_LogDataTable = new H_Log.HL_LogDataTable();
			this.Adapter.Fill(hL_LogDataTable);
			return hL_LogDataTable;
		}
		[DataObjectMethod(DataObjectMethodType.Select, false), HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual H_Log.HL_LogDataTable GetLogByIPHostName(string OperatorIP, string OperatorHostName)
		{
			this.Adapter.SelectCommand = this.CommandCollection[3];
			if (OperatorIP == null)
			{
				this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[0].Value = OperatorIP;
			}
			if (OperatorHostName == null)
			{
				this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
			}
			else
			{
				this.Adapter.SelectCommand.Parameters[1].Value = OperatorHostName;
			}
			H_Log.HL_LogDataTable hL_LogDataTable = new H_Log.HL_LogDataTable();
			this.Adapter.Fill(hL_LogDataTable);
			return hL_LogDataTable;
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Log.HL_LogDataTable dataTable)
		{
			return this.Adapter.Update(dataTable);
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(H_Log dataSet)
		{
			return this.Adapter.Update(dataSet, "HL_Log");
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow dataRow)
		{
			return this.Adapter.Update(new DataRow[]
			{
				dataRow
			});
		}
		[HelpKeyword("vs.data.TableAdapter"), System.Diagnostics.DebuggerNonUserCode]
		public virtual int Update(DataRow[] dataRows)
		{
			return this.Adapter.Update(dataRows);
		}
	}
}
